<html>
<head><title>Test results</title>
<script>
	var getXMLHttpRequest = function () {
		if (parent.XMLHttpRequest)
	        return new parent.XMLHttpRequest();
		else if (window.ActiveXObject)
	        return new ActiveXObject("Microsoft.XMLHTTP");
	}
	function send() {
			 	var xhr = getXMLHttpRequest();
				var ajaxDataReader = function () {
					if (xhr.readyState == 4) {// only if "OK"
						byId("status").innerHTML = xhr.status;
						byId("response").appendChild(document.createTextNode(xhr.responseText));
					}
				}
				byId("status").innerHTML = "";
				byId("response").innerHTML = "";
				xhr.onreadystatechange = ajaxDataReader;
			    xhr.open(byId("method").value,byId("url").value, true);
//		    	xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
			    xhr.send(byId("data").value);

	}
	function byId(id) {
		return document.getElementById(id);
	}
</script>
<body>
<h2>Direct HTTP</h2>
Url: <input type="text" id="url" /><br/>
Method: <input type="text" id="method" /><br/>
POST/PUT Data: <textarea id="data"></textarea><br/>
<button onclick="send()">Send</button><br/>
Response Status: <div id="status"></div>
Response Text: <div id="response"></div>

</body></html>
